package com.nondo.dean.dealer.controller.api.app;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.nondo.dean.common.annotation.ApiVersion;
import com.nondo.dean.common.web.View;
import com.nondo.dean.dealer.model.result.IndexResult;
import com.nondo.dean.dealer.service.IndexService;

/**
 * 经销商首页
 * @author zhaolijin
 * @date 2018年5月10日
 */
@RestController("apiAppDealerIndex")
@RequestMapping("/{v}/app/dealer")
public class IndexController {
    @Autowired
    IndexService indexService;
    
    /**
     * 获取首页数据
     *
     * @param request
     * @param response
     * @return
     */
    @ApiVersion(1)
    @RequestMapping("/index")
    public View<IndexResult> index(HttpServletRequest request, HttpServletResponse response) {
        View<IndexResult> view = new View<IndexResult>(20000, "获取数据成功");

        IndexResult indexResult = this.indexService.getIndex();

        view.setData(indexResult);

        return view;
    }
    
}
